<?php

include_once('includes/nusoap.php');
include_once('usuarios.php');
include_once('notas.php');

$server = new soap_server();

$server->configureWSDL('andronotes','urn:andronotes');

$server->register(
    'login',
    array(
        'email'     => 'xsd:string',
        'password'  => 'xsd:string'
    ),
    array('usuario_id' => 'xsd:int'),
    'xsd:andronotes'
);

$server->register(
    'register',
    array(
        'email'     => 'xsd:string',
        'password'  => 'xsd:string'
    ),
    array('usuario_id' => 'xsd:int'),
    'xsd:andronotes'
);

$server->register(
    'notasPorUsuario',
    array('usuario_id' => 'xsd:int'),
    array('notas_json' => 'xsd:string'),
    'xsd:andronotes'
);

$server->register(
    'guardarNota',
    array(
        'usuario_id'  => 'xsd:int',
        'titulo'      => 'xsd:string',
        'descripcion' => 'xsd:string',
        'modificado'  => 'xsd:string'
    ),
    array('nota_id' => 'xsd:int'),
    'xsd:andronotes'
);

$server->register(
    'modificarNota',
    array(
        'nota_id'     => 'xsd:int',
        'titulo'      => 'xsd:string',
        'descripcion' => 'xsd:string',
        'modificado'  => 'xsd:string'
    ),
    array('resultado' => 'xsd:int'),
    'xsd:andronotes'
);

$server->register(
    'borrarNota',
    array('nota_id'   => 'xsd:int'),
    array('resultado' => 'xsd:int'),
    'xsd:andronotes'
);

$HTTP_RAW_POST_DATA = isset($HTTP_RAW_POST_DATA) ? $HTTP_RAW_POST_DATA : ''; 

$server->service($HTTP_RAW_POST_DATA);
